package com.zzz.demo.async;


import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Component;

@Component
public class Main {

     public static void main(String[] args) {  
          AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(ThreadConfig.class);
          AsyncTask service = context.getBean(AsyncTask.class);

         // 执行异步任务
          for (int i = 0; i < 10; i++) {
              //执行时不一定按照调用顺序执行
//              service.task1();
//              service.task2();
//              service.task3();
          }
         System.out.println("活干完了");
         context.close();
     }

}